package Kolekcje;
import java.util.*;

public class TestMap {
	public static void main(String[] args) {
		Map<String, Pet> petMap = new HashMap<String, Pet>();
		petMap.put("Mój szczór", new Rat("Fiołek"));
		petMap.put("Mój chomik", new Hamster("Śmietanka"));
		petMap.put("Mój pies", new Pug("Tequilla"));
		System.out.println(petMap);
		Pet pies = petMap.get("Mój pies");
		System.out.println(pies);
		System.out.println(petMap.containsKey("Mój pies"));
		System.out.println(petMap.containsValue(pies));
		
		System.out.println("\nTest2:");
		Map<Person, List<Pet>> petPeople=new HashMap<Person, List<Pet>>();
		petPeople.put(new Person("Piotr"), Arrays.asList(new Hamster("Śmiechołek"), new Pug("Świnka"), new Mutt("Cosiek")));
		petPeople.put(new Person("Lucek"), Arrays.asList(new Hamster("Mały Lu"), new Rat("Tolek")));
		petPeople.put(new Person("Karolinka"),Arrays.asList(new Pug("Lolo vel Leonard Moppsen"), new Mutt("Stefan")));
		System.out.println("Osoby: "+petPeople.keySet());
		System.out.println("Zwierzaki: "+petPeople.values());
		for(Person person: petPeople.keySet()){
			System.out.println("\n"+person+" ma:");
			for(Pet pet: petPeople.get(person)){
				System.out.print(" "+pet);
			}
		}
	}

}
